<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html"%>

<jsp:directive.include file="/controleDeAcesso/autenticado.jsp" />

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Cadastro de Anúncios</title>
</head>
<body>
	<f:view>
		<h2>Cadastro de Anúncio</h2>
		
		<h:outputText value="#{principal.msg}" style="color: #FF0000"></h:outputText>
		
		<p>Entre com os dados do anúncio que deseja inserir:</p>
		<h:form>
			<h:panelGrid border="0" cellpadding="1" columns="3" style="background-color: #CCE0FF">
				<h:outputText value="ID: "></h:outputText>
				<h:inputText id="id" value="#{principal.anuncio.id}" required="true" 
					requiredMessage="O ID do anúncio deve ser preenchido"></h:inputText>
				<h:message for="id" style="color:red"></h:message>
				
				<h:outputText value="Resumo: "></h:outputText>
				<h:inputText id="resumo" value="#{principal.anuncio.resumo}" required="true" 
					requiredMessage="O resumo do anúncio deve ser preenchido"></h:inputText>
				<h:message for="resumo" style="color:red"></h:message>
				
				<h:outputText value="Detalhamento: "></h:outputText>
				<h:inputText id="detalhamento" value="#{principal.anuncio.detalhamento}" required="true" 
					requiredMessage="O detalhamento do anúncio deve ser preenchido"></h:inputText>
				<h:message for="detalhamento" style="color:red"></h:message>
				
				<h:outputText value="Valor: "></h:outputText>
				<h:inputText id="valor" value="#{principal.anuncio.valor}" required="true" 
					requiredMessage="O valor do produto anúnciado deve ser preenchido"></h:inputText>
				<h:message for="valor" style="color:red"></h:message>
			</h:panelGrid><br/>
			<h:commandButton value="Cadastrar Anúncio" action="#{principal.adicionaAnuncio}"></h:commandButton>
		</h:form>
	</f:view>
</body>
</html>